#MAKEFILE FOR DNS SERVER

#Select your platform (hack to get compilation under BSD, we'll use autotools in the future)
#PLATFORM=LINUX
#PLATFORM=BSD

#modify this for where your libpcap files are
#PCAPLIBS=-I/usr/lib/ -I/usr/include  
#PCAPLINK=-L/usr/lib/  

MAKEFLAGS=-j8
OBJS=main.o commandLineParser.o DnsServerConfiguration.o dnsPacket.o threads.o readerWriterLock.o semaphore.o mutex.o socketServerData.o socketServerThread.o udpServer.o packetBuffer.o udpMessage.o dnsQuestion.o dnsRecord.o resolverData.o resolverThread.o udpMessageQueue.o udpSocketServer.o IPv6Address.o staticBuffer.o dnsCache.o
CC=g++
CXXFLAGS=-ggdb -g3 -Wall -D DEFAULT_CONFIG_LOCATION=\"/etc/dns.conf\" -D DEFAULT_VIOLATION_LOG=\"/var/log/dnsViolations.log\"
OPTOMIZE=-O2 -funroll-loops -fprefetch-loop-arrays 
LDFLAGS=-lpthread #-lpcap
#LDTESTFLAGS= $(LDFLAGS) -ldl -lcppunit
DEPEND= makedepend $(CFLAGS)
	
VERSION=$(shell ./version.sh)

dnsd: $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS)

all: unitTest inavd 

unitTest: $(TESTOBJS)
	$(CC) $(LDTESTFLAGS) -o $@ $(TESTOBJS)

clean:
	-rm *.o dnsd
